Skip to content

fix(components): action:menu, action:group and action:icon render no text for a non-string label instead of crashing - #37323

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-37266-action-renderers-label-guard
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-37266-action-renderers-label-guard

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #37266
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:页面上的菜单、按钮组、图标按钮三种操作控件,名称若被写成多语言对象,以前菜单和按钮组会整块报错、图标按钮会崩溃或显示乱码;现在控件照常显示、照常可点,只是不显示那段名称(菜单仍叫“更多操作”,按钮组下拉仍叫“Actions”,图标按钮显示问号)。字符串名称和翻译与以前完全一样。
  • 为什么做:沿用上一张卡给普通操作按钮加的同一层显示保护,补齐它的三个兄弟控件,属于“操作按钮名称必须是字符串”这一修复的收尾,按维护者「保持走翻译包」的裁决执行,不改协议、不翻译多语言对象。
  • 出错会怎样:最坏是这三种控件上某个名称不显示,页面其余部分不受影响;改动可以直接撤回。
  • 要你做的:无。

What changes

ui/packages/components/src/renderers/action/:

  • New renderable-label.ts: the renderableLabel guard moved out of action-button.tsx unchanged in behaviour. It gains a componentType parameter (default action:button, so the button's warning text is byte-identical) and keys its warn-once memo on componentType:componentKey. withRenderableLabel(subject, key, type) returns the same object when the label is a string or absent, otherwise a copy with label: undefined. It is one guard, reused, not forked.
  • action-button.tsx: imports the guard; no other change.
  • action-menu.tsx, action-group.tsx, action-icon.tsx: each renderer guards its own schema once at entry (withRenderableLabel, keyed on the component id data-obj-id), and action:menu / action:group guard each member where actions is built (keyed on the member name, else COMPONENT_ID#INDEX). Every later read then sees a guarded label. The value is never translated (ruling A, 7118756694).
  • static-params.ts: the node-level-params warning names a nameless action through renderableLabel (scope note 7163349912).

Ruling: option A on #36717 (7118756694), inherited, verbatim: "The renderer must never throw on a non-string label: render no text (or the component id) and log a development warning; it must NOT translate the map (that would accept a value the contract refuses)." packages/spec is untouched.

Every label read and its disposition

The seat's re-check, git grep -n "schema.label\|action.label" -- ui/packages/components/src/renderers/action/, on origin/main d88c41e: 26 non-test hits.

File Read Disposition
action-button.tsx renderableLabel(schema.label, …), label === schema.label already guarded (PR #37262); now imports the shared guard
action-group.tsx useMemberVisible diagnostic action.label guarded: members built through withRenderableLabel
action-group.tsx inline leaf icon spacing action.label && 'mr-2' guarded (member)
action-group.tsx inline leaf text {action.label} guarded (member); renders no text
action-group.tsx dropdown leaf action.label || action.name guarded (member); shows name
action-group.tsx group visible diagnostic schema.label guarded: group schema through withRenderableLabel
action-group.tsx runner label: action.label guarded (member); runner gets none
action-group.tsx dropdown trigger schema.label || 'Actions' guarded (group); shows Actions
action-icon.tsx visible diagnostic schema.label guarded: icon schema through withRenderableLabel
action-icon.tsx runner label: schema.label guarded; runner gets none
action-icon.tsx aria-label={schema.label || schema.name} guarded; named by name
action-icon.tsx schema.label?.charAt(0) || '?' guarded; shows ? (threw on main)
action-icon.tsx disabled-reason heading schema.label || schema.description guarded
action-icon.tsx tooltip gate and text schema.label || schema.description (two hits) guarded
action-icon.tsx useAutoTriggerOnce(schema, …), readStaticParamValues(schema, …) (not grep hits) read the guarded schema
action-menu.tsx useMenuActionVisible diagnostic action.label guarded: members built through withRenderableLabel
action-menu.tsx item action.label || action.name guarded (member); shows name (threw on main)
action-menu.tsx menu visible diagnostic schema.label guarded: menu schema through withRenderableLabel
action-menu.tsx runner label: action.label guarded (member); runner gets none
action-menu.tsx trigger aria-label={schema.label || moreActionsLabel} guarded (menu); keeps More actions
action-menu.tsx trigger icon spacing and {schema.label && ...} (two hits) guarded (menu); renders no text (threw on main)
action-menu.tsx ActionAutoTrigger → useAutoTriggerOnce(action, …) (not a grep hit) reads the guarded member
auto-trigger.ts refusal notice and toast id action.name ?? action.label, action.label || action.name (three hits) not edited: it reads the subject its caller hands it, and all four callers now hand a guarded one
static-params.ts String(subject.name ?? subject.label ?? '(unnamed)') (not a grep hit) guarded (scope note 7163349912)

Tests

The pins live in the existing harness files, each as its own top-level describe naming objectstack#37266 (AGENTS.md, ruling record 6583487846). Each mounts the node through the real SchemaRenderer and ActionProvider:

  • __tests__/action-group-menu-inputs-11168.test.tsx, describe('action:group — a non-string label renders no text and never throws (objectstack#37266)'): inline (member button has no text and runs with no label, one warning) and dropdown (trigger shows Actions, member shows approve). CONTROL: string labels in both modes.
  • same file, describe('action:menu — a non-string label renders no text and never throws (objectstack#37266)'): a locale-map label on the menu and on a member. No throw, the trigger keeps More actions and has no text, the item shows approve, no [object Object] and neither locale string in the text, the runner gets no label, and there is one warning per component (menu and member). CONTROL: string labels render and reach the runner.
  • __tests__/action-icon-autotrigger.test.tsx, describe('action:icon — a non-string label renders no text and never throws (objectstack#37266)'): no icon (shows ?, named approve, runs with no label, one warning), with icon (aria-label is approve), and a nameless action with node-level object params (the static-params warning names (unnamed) and no warning carries [object Object]). CONTROL: a string label is the initial, the accessible name and the runner label.

Fitting the harnesses: the group and menu pins use that file's own mount (which adds SchemaRendererProvider and PredicateScopeProvider around the node), openMenu and run; their console.warn spy is set up inside each describe. The icon file drives action:icon as an action:bar member with an api handler, so the icon describe keeps its own run handler, SchemaRenderer mount, console.warn spy and static-params reset inside the describe. The file gained the imports for those. No assertion changed (50 expect( calls before and after).

Acceptance notes

  • The menu and group pins assert text and accessible names, not innerHTML. Both renderers spread the host's undeclared node keys onto the DOM, so actions="[object Object]" is an attribute on any menu or inline group on main, and a raw label attribute rides along. That is an attribute leak, not a label read, and it is not user-visible text. It is out of this guard's reach and not filed.
  • A nameless action with a locale-map label and node-level object params now gets two development warnings: the non-string-label warning (keyed (unnamed) for that renderer type) and the existing params warning. Both are dev-only.
  • An action:icon with a non-string label and no icon shows ?, the renderer's existing no-label fallback.
  • As on action:button, a numeric label is now dropped with the same warning; the contract (z.string()) already refuses it.

Verification

Two-minute check: pnpm --dir ui exec vitest run packages/components/src/renderers/action/__tests__/action-group-menu-inputs-11168.test.tsx packages/components/src/renderers/action/__tests__/action-icon-autotrigger.test.tsx -t "objectstack#37266". Expected: 9 tests passed, the rest skipped.

Ablation (shared guard reverted, head 97ac493)

node scripts/ablation-replace.mjs replaced the guard's string check in renderable-label.ts (if (label == null || typeof label === 'string') return label ?? undefined;) with return label as string | undefined;, then ran the two harness files. The anchor went from 1 hit to 0 and the blob from 0e979351f9ca to fa737ebae282. Result: 2 files failed, 6 tests failed and 37 passed. The 6 failures are the six non-CONTROL label pins; the 37 that passed are the three CONTROLs and every existing test in the two files. The menu test rendered the error boundary's Retry instead of the menu (the throw). Three icon tests failed with TypeError: schema.label?.charAt is not a function. The group tests failed on text content and the runner call. After the restore, the blob equals HEAD (0e979351f9ca) and git diff HEAD is empty.

Suites and gates (head 97ac493)
  • pnpm --filter @object-ui/components type-check && pnpm --dir ui exec vitest run packages/components/src/renderers/action/: type-check clean, 37 files and 628 tests passed (VERDICT command-exit 0).
  • After the pin move: pnpm check:test-source-alias, pnpm check:cross-package-test-inputs and pnpm check:nul-bytes each exited 0.
  • Round 1 (heads 49122c0 to 546ca7d): dispatch-gates --commands derived 38 families, all 38 were run and each exit code was captured before any pipe. --ran reconciliation gave 38 derived, 38 run, 0 NOT-MEASURED, and every recorded exit was 0. pnpm check:type-check-debt first exited 3, a prerequisite refusal whose cause the loop did not keep, and exited 0 on a standalone re-run. pnpm --dir ui exec vitest run scripts/: 172 files passed and 2 skipped; 5130 tests passed.
  • NOT MEASURED locally: the full packages/components suite and the CI-only lanes (Lint UI, Test UI shards, Build & E2E UI); CI runs them.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_012MmDsSBHy5paNUz6zke9Re

… labels through the shared renderableLabel guard

Claude-Session: https://claude.ai/code/session_012MmDsSBHy5paNUz6zke9Re
Co-authored-by: Claude <noreply@anthropic.com>
…d action:icon; patch changeset

Claude-Session: https://claude.ai/code/session_012MmDsSBHy5paNUz6zke9Re
Co-authored-by: Claude <noreply@anthropic.com>
…es, not the host's attribute spread

Claude-Session: https://claude.ai/code/session_012MmDsSBHy5paNUz6zke9Re
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
…u and action:icon harness files

Claude-Session: https://claude.ai/code/session_012MmDsSBHy5paNUz6zke9Re
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m and removed size/l labels Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · os-lizheng · session_012MmDsSBHy5paNUz6zke9Re

席位核对

ACCEPT · 2026-11-25T17:10Z · head 97ac493b971fd5458bf6aceeb0220ba45ae4eae6 · L1 by the dispatching seat. No L2 is owed: the change touches no contract face.

  • Clause-②: no holds on the built entry. ui/packages/components/src/index.ts re-exports only named action modules (visibility-gate, disabled-reason, resolve-icon). The new renderable-label.ts is not among them, and the package exports map has only . and ./style.css.

  • Metadata-protocol: none; the spec is untouched.

  • Shape: l1-face reads CLEAN. The PR is a draft against main, its first line closes action:menu / action:group / action:icon render a non-string label raw (action:menu throws on a locale map) #37266, and no other card is bound.

  • Ruling A 7118756694 (inherited): renderableLabel renders no text for a non-string label and warns once in development. It never translates the map. The guard moved, unforked, into renderable-label.ts, with componentType defaulting to action:button, so the button's warning and its pins are unchanged.

    • action:menu, action:group and action:icon each guard their own schema once at entry; menu and group also guard each member.
    • static-params.ts names a nameless action through the same guard (scope note 7163349912).
    • The PR body tables all 24 label reads.
  • Seat's error, corrected: the dispatch order asked for new pin files. That contradicts AGENTS.md (ruling record 6583487846): a new pin for a component with a shared harness goes into that file. The dev flagged it. The patch round moved the pins into action-group-menu-inputs-11168.test.tsx and action-icon-autotrigger.test.tsx as top-level describes naming objectstack#37266, with no assertion changed (50 expect( before and after).

  • Pins: ablation on renderable-label.ts at this head turned the 6 non-CONTROL pins red (the menu rendered the error boundary; the icon threw schema.label?.charAt is not a function). The 3 CONTROLs and every existing test in both files stayed green. The restore was blob-equal.

  • Changeset: one @object-ui/components patch, read sentence by sentence; each sentence matches the diff.

  • Gates (check-runs at this head): 47 success, 15 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are both success.

  • Landing reads: check-governed-merges --pr 37323 reads NOT governed (0 of 9 paths), 413 changed lines. K = 13 (merge-base d88c41e, first parent), under 15. git merge-tree is clean, and nothing under renderers/action/ moved on main.

  • Deviation accepted: in round 2, overlap-check ran after the push instead of before; it was clean.

  • Out of scope: action:menu and inline action:group spread undeclared node keys onto the DOM (actions="[object Object]"). This is an attribute leak, not user-visible text. It is noted in the Acceptance notes and not filed: there is no user-visible reach.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#6 · os-lizheng · session_012MmDsSBHy5paNUz6zke9Re

Landing (2026-11-25T17:11Z): head 97ac493b971fd5458bf6aceeb0220ba45ae4eae6, on L1 ACCEPT 7169124859. No L2 owed (no contract face).

Probe Reading
check-governed-merges.mjs --pr 37323 NOT governed: 0 of 9 paths hit the register; 413 changed lines, under the human-merge threshold
Check-runs at this head 47 success · 15 expected skip · 0 failed · 0 pending; mergeable_state clean
Landing K 13 (git, first parent from merge-base d88c41e); under 15; git merge-tree clean

State: pr_ready + automerge_enable; #37266 closes on merge through Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 17:11
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit dbc1765 Nov 25, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37266-action-renderers-label-guard branch November 25, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

action:menu / action:group / action:icon render a non-string label raw (action:menu throws on a locale map)

2 participants